LOCAL_PATH := $(call my-dir)

define all-cpp-files-under
$(patsubst ./%,%, \
  $(shell cd $(LOCAL_PATH) ; \
          find $(1) -name "*.cpp" -and -not -name ".*") \
 )
endef

define all-cc-files-under
$(patsubst ./%,%, \
  $(shell cd $(LOCAL_PATH) ; \
          find $(1) -name "*.cc" -and -not -name ".*") \
 )
endef

define all-c-files-under
$(patsubst ./%,%, \
  $(shell cd $(LOCAL_PATH) ; \
          find $(1) -name "*.c" -and -not -name ".*") \
 )
endef

include $(CLEAR_VARS)


LOCAL_MODULE := game_shared

LOCAL_MODULE_FILENAME := libgame

LOCAL_SRC_FILES := battlecry/main.cpp  $(call all-cpp-files-under,../../Classes) $(call all-c-files-under,../../Classes) $(call all-cc-files-under,../../Classes)                   
LOCAL_CFLAGS := -std=gnu++11 -Wno-psabi -DANDROID -DHAVE_PTHREAD -DDHLOG -DDEBUG -DANDROID_ENG -Wmissing-field-initializers -Wreturn-type -Wuninitialized
                   
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../Classes \
$(LOCAL_PATH)/../../Classes/base \
$(LOCAL_PATH)/../../Classes/bullet \
$(LOCAL_PATH)/../../Classes/global \
$(LOCAL_PATH)/../../Classes/scene \
$(LOCAL_PATH)/../../Classes/gamedata \
$(LOCAL_PATH)/../../Classes/manager \
$(LOCAL_PATH)/../../Classes/unit \
$(LOCAL_PATH)/../../Classes/utility \
$(LOCAL_PATH)/../../Classes/spine \
$(LOCAL_PATH)/../../Classes/protobuf \


LOCAL_WHOLE_STATIC_LIBRARIES += cocos2dx_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocosdenshion_static
LOCAL_WHOLE_STATIC_LIBRARIES += box2d_static
LOCAL_WHOLE_STATIC_LIBRARIES += chipmunk_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocos_extension_static

include $(BUILD_SHARED_LIBRARY)

$(call import-module,cocos2dx)
$(call import-module,cocos2dx/platform/third_party/android/prebuilt/libcurl)
$(call import-module,CocosDenshion/android)
$(call import-module,extensions)
$(call import-module,external/Box2D)
$(call import-module,external/chipmunk)
